using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class sc_AppListMap : EntityTypeConfiguration<sc_AppList>
    {
        public sc_AppListMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Status, t.Recall_Condition, t.Unconfirmation_Reason });

            // Properties
            this.Property(t => t.Hijri_Date)
                .HasMaxLength(10);

            this.Property(t => t.Time)
                .HasMaxLength(17);

            this.Property(t => t.Duration)
                .HasMaxLength(18);

            this.Property(t => t.Booking_Date)
                .HasMaxLength(10);

            this.Property(t => t.Room)
                .IsFixedLength()
                .HasMaxLength(20);

            this.Property(t => t.Procedure)
                .IsFixedLength()
                .HasMaxLength(6);

            this.Property(t => t.Status)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(t => t.Recall_Condition)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(t => t.Unconfirmation_Reason)
                .IsRequired()
                .HasMaxLength(17);

            this.Property(t => t.Physician)
                .HasMaxLength(35);

            this.Property(t => t.User_Name)
                .HasMaxLength(15);

            this.Property(t => t.Comment)
                .HasMaxLength(50);

            this.Property(t => t.Patient_)
                .HasMaxLength(15);

            // Table & Column Mappings
            this.ToTable("sc_AppList");
            this.Property(t => t.Hijri_Date).HasColumnName("Hijri Date");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Time).HasColumnName("Time");
            this.Property(t => t.Duration).HasColumnName("Duration");
            this.Property(t => t.Booking_Date).HasColumnName("Booking Date");
            this.Property(t => t.Room).HasColumnName("Room");
            this.Property(t => t.Procedure).HasColumnName("Procedure");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Recall_Condition).HasColumnName("Recall Condition");
            this.Property(t => t.Unconfirmation_Reason).HasColumnName("Unconfirmation Reason");
            this.Property(t => t.Physician).HasColumnName("Physician");
            this.Property(t => t.User_Name).HasColumnName("User Name");
            this.Property(t => t.Comment).HasColumnName("Comment");
            this.Property(t => t.Patient_).HasColumnName("Patient#");
        }
    }
}
